<template>
  <view class="login-page">
    <view>登录页面</view>
    <view>{{hasLogin ? '已经登录' : '未登录'}}</view>
    <view>{{sex}}</view>
    <view>{{sexTxt}}</view>
    <button @click="onTapLogin(2)">登录</button>
    <button @click="logout">登出</button>
  </view>
</template>

<script>
    import {mapState, mapMutations, mapGetters} from 'vuex'
    import Core from "core/core";

    export default {
        data() {
            return {}
        },
        computed: {
            ...mapState(['hasLogin', 'sex']),
            ...mapGetters(['sexTxt'])
        },
        onLoad() {
            console.log("login page onLoad")
        },
        onShow() {
            console.log("login page onShow")
        },
        onUnload() {
            console.log("login page onUnload")
        },
        methods: {
            ...mapMutations(['logout']),
            onTapLogin() {
                this.$store.commit("login", 1);
                Core.Event.emit("wx-test", 'hello')
            }
        }
    }
</script>

<style lang="scss" scoped>
  @import "./index.scss";
</style>

